<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
    #mydiv{
        width: 300px;
        height: 200px;
        background: red;
    }
    </style>
</head>
<body>
    <div id="mydiv" class="hi">
        hello
    </div>
    <button onclick="demo()">按钮</button>
    <script>
        function demo(){
            var nihao=document.getElementById("mydiv");
            nihao.style.background="blue";//赋值用等号；
        }
    </script>
</body>
</html>